package com.shengyuan.manage_os.old.ying.erpm;

import com.shengyuan.manage_os.R;
import com.shengyuan.manage_os.old.ying.boce.jsy.APIErpm;
import com.shengyuan.manage_os.old.ying.boce.jsy.PT_yhmc;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class Actual_WebView extends Activity {

	private Handler handler = null;
	protected WebView webView01;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.actual_webview);
		webView01 = (WebView) findViewById(R.id.webView01);
		Setting();
		webView01.setWebViewClient(new WebViewClient() {});
		handler = new Handler();
		loadURL( APIErpm.GetMobileAndroid(LoginActivity.pmUser.UserName, LoginActivity.pmUser.Password));
		
		//点击后退按钮,让WebView后退一页(也可以覆写Activity的onKeyDown方法)  
		webView01.setOnKeyListener(new View.OnKeyListener() {  
            @Override  
            public boolean onKey(View v, int keyCode, KeyEvent event) {  
                if (event.getAction() == KeyEvent.ACTION_DOWN) {  
                    if (keyCode == KeyEvent.KEYCODE_BACK && webView01.canGoBack()) {  
                    	webView01.goBack();   //后退  
                        return true;    //已处理  
                    }  
                }  
                return false;  
            }
        });

	}
	private void loadURL(final String in){
        handler.post(new Runnable() {
            public void run() {
            	webView01.loadUrl(in);
            }
        });
    }

	private void Setting()
	{
		webView01.getSettings().setSavePassword(false);
		webView01.getSettings().setSaveFormData(false);
		webView01.getSettings().setJavaScriptEnabled(true);
		webView01.getSettings().setSupportZoom(false);
	}


}
